import request from '@/config/axios'

// 采购管理主 VO
export interface PurchaseManageVO {
  id: number // 主键
  planId: number // 关联采购计划ID
  planName: string // 采购计划名称
  purchasePlanNo: string // 采购计划编号
  purchaseBudget: number // 采购预算(万元)
  purchaseMethod: string // 采购方式
  projectReason: string // 项目理由
}

// 采购管理主 API
export const PurchaseManageApi = {
  // 查询采购管理主分页
  getPurchaseManagePage: async (params: any) => {
    return await request.get({ url: `/erp/purchase-manage/page`, params })
  },

  // 查询采购管理主详情
  getPurchaseManage: async (id: number) => {
    return await request.get({ url: `/erp/purchase-manage/get?id=` + id })
  },

  // 新增采购管理主
  createPurchaseManage: async (data: PurchaseManageVO) => {
    return await request.post({ url: `/erp/purchase-manage/create`, data })
  },

  // 修改采购管理主
  updatePurchaseManage: async (data: PurchaseManageVO) => {
    return await request.put({ url: `/erp/purchase-manage/update`, data })
  },

  // 删除采购管理主
  deletePurchaseManage: async (id: number) => {
    return await request.delete({ url: `/erp/purchase-manage/delete?id=` + id })
  },

  // 导出采购管理主 Excel
  exportPurchaseManage: async (params) => {
    return await request.download({ url: `/erp/purchase-manage/export-excel`, params })
  }
}